package com.nulldev.util.security.encryptAPI_rw.utils;

public class CipherPaddingUtil {

	public static void __pad_array(final byte[] arr, final int start) {
		__pad_array(arr, start, (byte) '\4');
	}

	public static void __pad_array(final byte[] arr, final int start, final byte c) {
		for (int i = start; i < arr.length; i++) {
			arr[i] = c;
		}
	}

	public static boolean __contains_padding(final byte[] data) {
		return data[data.length - 1] == (byte) '\4';
	}

	public static int __unpadded_length(final byte[] data) {
		int length = data.length;
		for (int i = data.length - 1; i >= 0; i--) {
			if (data[i] != '\4')
				break;
			length--;
		}
		return length;
	}
}
